package cn.iocoder.yudao.module.pay.convert.wallet;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface PayWalletConvert {
    @Mappings({
            @Mapping(source = "bean.id", target = "id"),
            @Mapping(source = "goldWallet.id", target = "goldId"),
            @Mapping(source = "goldWallet.balance", target = "goldBalance"),
            @Mapping(source = "bean.balance", target = "balance"),
            @Mapping(source = "goldWallet.totalExpense", target = "goldTotalExpense"),
            @Mapping(source = "bean.totalExpense", target = "totalExpense"),
            @Mapping(source = "bean.totalRecharge", target = "totalRecharge"),
            @Mapping(source = "goldWallet.totalRecharge", target = "goldTotalRecharge"),
            @Mapping(source = "goldWallet.freezePrice", target = "goldFrozen"),
            @Mapping(source = "bean.freezePrice", target = "frozen"),
    })
    AppPayWalletRespVO convert(PayWalletDO bean, PayWalletDO goldWallet);


    PayWalletConvert INSTANCE = Mappers.getMapper(PayWalletConvert.class);

    PayWalletRespVO convert02(PayWalletDO bean);

    PageResult<PayWalletRespVO> convertPage(PageResult<PayWalletDO> page);

}
